import numpy as np


def my_train_test_split(X, y, test_size=0.2, random_state=None):
	assert X.shape[0] == y.shape[0], \
		"The size of X must be equal to the size of y"

	if random_state is not None:
		np.random.seed(random_state)

	shuffle_indexes = np.random.permutation(X.shape[0])

	test_count = int(test_size * X.shape[0])

	test_indexes = shuffle_indexes[:test_count]
	train_indexes = shuffle_indexes[test_count:]

	X_train = X[train_indexes]
	X_test = X[test_indexes]
	y_train = y[train_indexes]
	y_test = y[test_indexes]

	return X_train, X_test, y_train, y_test
